<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>一种最简单粗暴的打表演示 | Sevin的小窝</title><meta name="keywords" content="暴力,技巧"><meta name="author" content="Sevin"><meta name="copyright" content="Sevin"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="一种最简单粗暴的打表演示例题（P1217 [USACO1.5] 回文质数 Prime Palindromes）题目描述因为 151151 既是一个质数又是一个回文数（从左到右和从右到左是看一样的），所以 151151 是回文质数。 写一个程序来找出范围 [a,b] (5≤a&lt;b≤100,000,000) [a,b] (5≤a&lt;b≤100,000,000)（一亿）间的所有回文质数。 暴力">
<meta property="og:type" content="article">
<meta property="og:title" content="一种最简单粗暴的打表演示">
<meta property="og:url" content="https://blog.sevin.cn/posts/12620/index.html">
<meta property="og:site_name" content="Sevin的小窝">
<meta property="og:description" content="一种最简单粗暴的打表演示例题（P1217 [USACO1.5] 回文质数 Prime Palindromes）题目描述因为 151151 既是一个质数又是一个回文数（从左到右和从右到左是看一样的），所以 151151 是回文质数。 写一个程序来找出范围 [a,b] (5≤a&lt;b≤100,000,000) [a,b] (5≤a&lt;b≤100,000,000)（一亿）间的所有回文质数。 暴力">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://api.sevin.cn/api/img/ecy/%20(132).jpg">
<meta property="article:published_time" content="2024-11-02T23:20:00.000Z">
<meta property="article:modified_time" content="2025-07-07T09:39:46.440Z">
<meta property="article:author" content="Sevin">
<meta property="article:tag" content="暴力">
<meta property="article:tag" content="技巧">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://api.sevin.cn/api/img/ecy/%20(132).jpg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://blog.sevin.cn/posts/12620/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//hm.baidu.com"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><meta name="google-site-verification" content="gzenv5Dy9Dwe2fxxkarrJcNmN3FTFrenAmlns4dNg7o"/><meta name="baidu-site-verification" content="code-RhDOYEYqZn"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.min.css" media="print" onload="this.media='all'"><script>var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?996684846661df540f0abcc7f141c225";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script><link rel="stylesheet" href="/Sevin" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.xml","preload":true,"languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":50,"languages":{"author":"作者: Sevin","link":"链接: ","source":"来源: Sevin的小窝","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#1f1f1f","position":"bottom-left"},
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: true,
  islazyload: false,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '一种最简单粗暴的打表演示',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2025-07-07 09:39:46'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script><script>LA.init({id:"JwLxjAba3D2cfbQE",ck:"JwLxjAba3D2cfbQE"})</script><!-- hexo injector head_end start --><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-swiper/swiper/swiper.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-swiper/swiper/swiperstyle.css"><!-- hexo injector head_end end --><meta name="generator" content="Hexo 6.2.0"><link rel="alternate" href="/feed.xml" title="Sevin的小窝" type="application/rss+xml">
</head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://q.qlogo.cn/g?b=qq&amp;nk=2720269770&amp;s=640" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">42</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">36</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">8</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fa-fw fas fa-list"></i><span> 其他</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/mytools/"><i class="fa-fw fa-solid fa-toolbox"></i><span> 我的工具页</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" target="_blank" rel="noopener external nofollow noreferrer" href="https://home.sevin.cn"><i class="fa-fw fa-solid fa-house-user"></i><span> 主页</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://api.sevin.cn/api/img/ecy/%20(132).jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">Sevin的小窝</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fa-fw fas fa-list"></i><span> 其他</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/mytools/"><i class="fa-fw fa-solid fa-toolbox"></i><span> 我的工具页</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" target="_blank" rel="noopener external nofollow noreferrer" href="https://home.sevin.cn"><i class="fa-fw fa-solid fa-house-user"></i><span> 主页</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">一种最简单粗暴的打表演示</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2024-11-02T23:20:00.000Z" title="发表于 2024-11-02 23:20:00">2024-11-02</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2025-07-07T09:39:46.440Z" title="更新于 2025-07-07 09:39:46">2025-07-07</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/ACM/">ACM</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">1.3k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>7分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="一种最简单粗暴的打表演示"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span><span class="post-meta-separator">|</span><span class="post-meta-commentcount"><i class="far fa-comments fa-fw post-meta-icon"></i><span class="post-meta-label">评论数:</span><a href="/posts/12620/#post-comment"><span class="gitalk-comment-count"><i class="fa-solid fa-spinner fa-spin"></i></span></a></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="一种最简单粗暴的打表演示"><a href="#一种最简单粗暴的打表演示" class="headerlink" title="一种最简单粗暴的打表演示"></a>一种最简单粗暴的打表演示</h1><h2 id="例题（P1217-USACO1-5-回文质数-Prime-Palindromes）"><a href="#例题（P1217-USACO1-5-回文质数-Prime-Palindromes）" class="headerlink" title="例题（P1217 [USACO1.5] 回文质数 Prime Palindromes）"></a>例题（P1217 [USACO1.5] 回文质数 Prime Palindromes）</h2><h3 id="题目描述"><a href="#题目描述" class="headerlink" title="题目描述"></a>题目描述</h3><p>因为 151151 既是一个质数又是一个回文数（从左到右和从右到左是看一样的），所以 151151 是回文质数。</p>
<p>写一个程序来找出范围 [a,b] (5≤a&lt;b≤100,000,000) [<em>a</em>,<em>b</em>] (5≤<em>a</em>&lt;<em>b</em>≤100,000,000)（一亿）间的所有回文质数。</p>
<h3 id="暴力打表解法"><a href="#暴力打表解法" class="headerlink" title="暴力打表解法"></a>暴力打表解法</h3><h4 id="把一亿以内的质数打出来"><a href="#把一亿以内的质数打出来" class="headerlink" title="把一亿以内的质数打出来"></a>把一亿以内的质数打出来</h4><figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span><span class="string">&lt;cstdio&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span><span class="string">&lt;algorithm&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span><span class="string">&lt;cstring&gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> std;</span><br><span class="line"><span class="meta">#<span class="keyword">define</span> maxn 100000000</span></span><br><span class="line"><span class="type">bool</span> k[maxn];<span class="comment">//这里用int类型的数组太大，因此使用bool类型的数组</span></span><br><span class="line"><span class="type">int</span> cnt;</span><br><span class="line"><span class="function"><span class="type">int</span> <span class="title">main</span><span class="params">()</span></span>&#123;</span><br><span class="line">	<span class="built_in">freopen</span>(<span class="string">&quot;1.in&quot;</span>,<span class="string">&quot;w&quot;</span>,stdout);<span class="comment">//把打表结果放在一个文件里</span></span><br><span class="line">	<span class="keyword">for</span>(<span class="type">int</span> i=<span class="number">2</span>;i&lt;=maxn;i++)&#123;</span><br><span class="line">	<span class="keyword">if</span>(!k[i])&#123;</span><br><span class="line">		<span class="type">int</span> j=<span class="number">1</span>;</span><br><span class="line">		cnt++;</span><br><span class="line">		<span class="built_in">printf</span>(<span class="string">&quot;%d &quot;</span>,i);</span><br><span class="line">		<span class="keyword">while</span>(i*j&lt;=maxn)&#123;</span><br><span class="line">			k[i*j]=<span class="literal">true</span>;</span><br><span class="line">			j++;</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	</span><br><span class="line">	<span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="把得到的质数中的回文质数找出来"><a href="#把得到的质数中的回文质数找出来" class="headerlink" title="把得到的质数中的回文质数找出来"></a>把得到的质数中的回文质数找出来</h4><figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span><span class="string">&lt;cstdio&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span><span class="string">&lt;algorithm&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span><span class="string">&lt;cstring&gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> std;</span><br><span class="line"><span class="type">char</span> k[<span class="number">100</span>];</span><br><span class="line"><span class="type">int</span> ans;<span class="comment">//记录回文质数的个数</span></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="type">int</span> <span class="title">main</span><span class="params">()</span></span>&#123;</span><br><span class="line">	<span class="built_in">freopen</span>(<span class="string">&quot;1.in&quot;</span>,<span class="string">&quot;r&quot;</span>,stdin);</span><br><span class="line">	<span class="built_in">freopen</span>(<span class="string">&quot;2.out&quot;</span>,<span class="string">&quot;w&quot;</span>,stdout);</span><br><span class="line">	<span class="keyword">while</span>(<span class="built_in">scanf</span>(<span class="string">&quot;%s&quot;</span>,k)!=EOF)&#123;</span><br><span class="line">		<span class="type">int</span> n=<span class="built_in">strlen</span>(k);</span><br><span class="line">		<span class="type">int</span> flg=<span class="number">0</span>;</span><br><span class="line">		<span class="keyword">for</span>(<span class="type">int</span> i=<span class="number">0</span>;i&lt;=n/<span class="number">2</span>;i++)&#123;</span><br><span class="line">			<span class="keyword">if</span>(k[i]!=k[n-i<span class="number">-1</span>]) &#123;</span><br><span class="line">				flg=<span class="number">1</span>;<span class="keyword">break</span>;	</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">		<span class="keyword">if</span>(flg==<span class="number">0</span>) &#123;</span><br><span class="line">			ans++;</span><br><span class="line">			<span class="keyword">for</span>(<span class="type">int</span> i=<span class="number">0</span>;i&lt;n;i++)&#123;</span><br><span class="line">				<span class="built_in">printf</span>(<span class="string">&quot;%c&quot;</span>,k[i]);</span><br><span class="line">			&#125;</span><br><span class="line">			<span class="built_in">printf</span>(<span class="string">&quot;,&quot;</span>);</span><br><span class="line">		&#125;</span><br><span class="line">		<span class="built_in">memset</span>(k,<span class="number">0</span>,<span class="built_in">sizeof</span>(k));</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="built_in">printf</span>(<span class="string">&quot;\n\n%d&quot;</span>,ans);</span><br><span class="line">	<span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="打出最终程序"><a href="#打出最终程序" class="headerlink" title="打出最终程序"></a>打出最终程序</h4><figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span><span class="string">&lt;cstdio&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span><span class="string">&lt;algorithm&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span><span class="string">&lt;cstring&gt;</span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> std;</span><br><span class="line"><span class="type">int</span> ans[<span class="number">1000</span>]=&#123;<span class="number">0</span>,<span class="number">2</span>,<span class="number">3</span>,<span class="number">5</span>,<span class="number">7</span>,<span class="number">11</span>,<span class="number">101</span>,<span class="number">131</span>,<span class="number">151</span>,<span class="number">181</span>,<span class="number">191</span>,<span class="number">313</span>,<span class="number">353</span>,<span class="number">373</span>,<span class="number">383</span>,<span class="number">727</span>,<span class="number">757</span>,<span class="number">787</span>,<span class="number">797</span>,<span class="number">919</span>,<span class="number">929</span>,<span class="number">10301</span>,<span class="number">10501</span>,<span class="number">10601</span>,<span class="number">11311</span>,<span class="number">11411</span>,<span class="number">12421</span>,<span class="number">12721</span>,<span class="number">12821</span>,<span class="number">13331</span>,<span class="number">13831</span>,<span class="number">13931</span>,<span class="number">14341</span>,<span class="number">14741</span>,<span class="number">15451</span>,<span class="number">15551</span>,<span class="number">16061</span>,<span class="number">16361</span>,<span class="number">16561</span>,<span class="number">16661</span>,<span class="number">17471</span>,<span class="number">17971</span>,<span class="number">18181</span>,<span class="number">18481</span>,<span class="number">19391</span>,<span class="number">19891</span>,<span class="number">19991</span>,<span class="number">30103</span>,<span class="number">30203</span>,<span class="number">30403</span>,<span class="number">30703</span>,<span class="number">30803</span>,<span class="number">31013</span>,<span class="number">31513</span>,<span class="number">32323</span>,<span class="number">32423</span>,<span class="number">33533</span>,<span class="number">34543</span>,<span class="number">34843</span>,<span class="number">35053</span>,<span class="number">35153</span>,<span class="number">35353</span>,<span class="number">35753</span>,<span class="number">36263</span>,<span class="number">36563</span>,<span class="number">37273</span>,<span class="number">37573</span>,<span class="number">38083</span>,<span class="number">38183</span>,<span class="number">38783</span>,<span class="number">39293</span>,<span class="number">70207</span>,<span class="number">70507</span>,<span class="number">70607</span>,<span class="number">71317</span>,<span class="number">71917</span>,<span class="number">72227</span>,<span class="number">72727</span>,<span class="number">73037</span>,<span class="number">73237</span>,<span class="number">73637</span>,<span class="number">74047</span>,<span class="number">74747</span>,<span class="number">75557</span>,<span class="number">76367</span>,<span class="number">76667</span>,<span class="number">77377</span>,<span class="number">77477</span>,<span class="number">77977</span>,<span class="number">78487</span>,<span class="number">78787</span>,<span class="number">78887</span>,<span class="number">79397</span>,<span class="number">79697</span>,<span class="number">79997</span>,<span class="number">90709</span>,<span class="number">91019</span>,<span class="number">93139</span>,<span class="number">93239</span>,<span class="number">93739</span>,<span class="number">94049</span>,<span class="number">94349</span>,<span class="number">94649</span>,<span class="number">94849</span>,<span class="number">94949</span>,<span class="number">95959</span>,<span class="number">96269</span>,<span class="number">96469</span>,<span class="number">96769</span>,<span class="number">97379</span>,<span class="number">97579</span>,<span class="number">97879</span>,<span class="number">98389</span>,<span class="number">98689</span>,<span class="number">1003001</span>,<span class="number">1008001</span>,<span class="number">1022201</span>,<span class="number">1028201</span>,<span class="number">1035301</span>,<span class="number">1043401</span>,<span class="number">1055501</span>,<span class="number">1062601</span>,<span class="number">1065601</span>,<span class="number">1074701</span>,<span class="number">1082801</span>,<span class="number">1085801</span>,<span class="number">1092901</span>,<span class="number">1093901</span>,<span class="number">1114111</span>,<span class="number">1117111</span>,<span class="number">1120211</span>,<span class="number">1123211</span>,<span class="number">1126211</span>,<span class="number">1129211</span>,<span class="number">1134311</span>,<span class="number">1145411</span>,<span class="number">1150511</span>,<span class="number">1153511</span>,<span class="number">1160611</span>,<span class="number">1163611</span>,<span class="number">1175711</span>,<span class="number">1177711</span>,<span class="number">1178711</span>,<span class="number">1180811</span>,<span class="number">1183811</span>,<span class="number">1186811</span>,<span class="number">1190911</span>,<span class="number">1193911</span>,<span class="number">1196911</span>,<span class="number">1201021</span>,<span class="number">1208021</span>,<span class="number">1212121</span>,<span class="number">1215121</span>,<span class="number">1218121</span>,<span class="number">1221221</span>,<span class="number">1235321</span>,<span class="number">1242421</span>,<span class="number">1243421</span>,<span class="number">1245421</span>,<span class="number">1250521</span>,<span class="number">1253521</span>,<span class="number">1257521</span>,<span class="number">1262621</span>,<span class="number">1268621</span>,<span class="number">1273721</span>,<span class="number">1276721</span>,<span class="number">1278721</span>,<span class="number">1280821</span>,<span class="number">1281821</span>,<span class="number">1286821</span>,<span class="number">1287821</span>,<span class="number">1300031</span>,<span class="number">1303031</span>,<span class="number">1311131</span>,<span class="number">1317131</span>,<span class="number">1327231</span>,<span class="number">1328231</span>,<span class="number">1333331</span>,<span class="number">1335331</span>,<span class="number">1338331</span>,<span class="number">1343431</span>,<span class="number">1360631</span>,<span class="number">1362631</span>,<span class="number">1363631</span>,<span class="number">1371731</span>,<span class="number">1374731</span>,<span class="number">1390931</span>,<span class="number">1407041</span>,<span class="number">1409041</span>,<span class="number">1411141</span>,<span class="number">1412141</span>,<span class="number">1422241</span>,<span class="number">1437341</span>,<span class="number">1444441</span>,<span class="number">1447441</span>,<span class="number">1452541</span>,<span class="number">1456541</span>,<span class="number">1461641</span>,<span class="number">1463641</span>,<span class="number">1464641</span>,<span class="number">1469641</span>,<span class="number">1486841</span>,<span class="number">1489841</span>,<span class="number">1490941</span>,<span class="number">1496941</span>,<span class="number">1508051</span>,<span class="number">1513151</span>,<span class="number">1520251</span>,<span class="number">1532351</span>,<span class="number">1535351</span>,<span class="number">1542451</span>,<span class="number">1548451</span>,<span class="number">1550551</span>,<span class="number">1551551</span>,<span class="number">1556551</span>,<span class="number">1557551</span>,<span class="number">1565651</span>,<span class="number">1572751</span>,<span class="number">1579751</span>,<span class="number">1580851</span>,<span class="number">1583851</span>,<span class="number">1589851</span>,<span class="number">1594951</span>,<span class="number">1597951</span>,<span class="number">1598951</span>,<span class="number">1600061</span>,<span class="number">1609061</span>,<span class="number">1611161</span>,<span class="number">1616161</span>,<span class="number">1628261</span>,<span class="number">1630361</span>,<span class="number">1633361</span>,<span class="number">1640461</span>,<span class="number">1643461</span>,<span class="number">1646461</span>,<span class="number">1654561</span>,<span class="number">1657561</span>,<span class="number">1658561</span>,<span class="number">1660661</span>,<span class="number">1670761</span>,<span class="number">1684861</span>,<span class="number">1685861</span>,<span class="number">1688861</span>,<span class="number">1695961</span>,<span class="number">1703071</span>,<span class="number">1707071</span>,<span class="number">1712171</span>,<span class="number">1714171</span>,<span class="number">1730371</span>,<span class="number">1734371</span>,<span class="number">1737371</span>,<span class="number">1748471</span>,<span class="number">1755571</span>,<span class="number">1761671</span>,<span class="number">1764671</span>,<span class="number">1777771</span>,<span class="number">1793971</span>,<span class="number">1802081</span>,<span class="number">1805081</span>,<span class="number">1820281</span>,<span class="number">1823281</span>,<span class="number">1824281</span>,<span class="number">1826281</span>,<span class="number">1829281</span>,<span class="number">1831381</span>,<span class="number">1832381</span>,<span class="number">1842481</span>,<span class="number">1851581</span>,<span class="number">1853581</span>,<span class="number">1856581</span>,<span class="number">1865681</span>,<span class="number">1876781</span>,<span class="number">1878781</span>,<span class="number">1879781</span>,<span class="number">1880881</span>,<span class="number">1881881</span>,<span class="number">1883881</span>,<span class="number">1884881</span>,<span class="number">1895981</span>,<span class="number">1903091</span>,<span class="number">1908091</span>,<span class="number">1909091</span>,<span class="number">1917191</span>,<span class="number">1924291</span>,<span class="number">1930391</span>,<span class="number">1936391</span>,<span class="number">1941491</span>,<span class="number">1951591</span>,<span class="number">1952591</span>,<span class="number">1957591</span>,<span class="number">1958591</span>,<span class="number">1963691</span>,<span class="number">1968691</span>,<span class="number">1969691</span>,<span class="number">1970791</span>,<span class="number">1976791</span>,<span class="number">1981891</span>,<span class="number">1982891</span>,<span class="number">1984891</span>,<span class="number">1987891</span>,<span class="number">1988891</span>,<span class="number">1993991</span>,<span class="number">1995991</span>,<span class="number">1998991</span>,<span class="number">3001003</span>,<span class="number">3002003</span>,<span class="number">3007003</span>,<span class="number">3016103</span>,<span class="number">3026203</span>,<span class="number">3064603</span>,<span class="number">3065603</span>,<span class="number">3072703</span>,<span class="number">3073703</span>,<span class="number">3075703</span>,<span class="number">3083803</span>,<span class="number">3089803</span>,<span class="number">3091903</span>,<span class="number">3095903</span>,<span class="number">3103013</span>,<span class="number">3106013</span>,<span class="number">3127213</span>,<span class="number">3135313</span>,<span class="number">3140413</span>,<span class="number">3155513</span>,<span class="number">3158513</span>,<span class="number">3160613</span>,<span class="number">3166613</span>,<span class="number">3181813</span>,<span class="number">3187813</span>,<span class="number">3193913</span>,<span class="number">3196913</span>,<span class="number">3198913</span>,<span class="number">3211123</span>,<span class="number">3212123</span>,<span class="number">3218123</span>,<span class="number">3222223</span>,<span class="number">3223223</span>,<span class="number">3228223</span>,<span class="number">3233323</span>,<span class="number">3236323</span>,<span class="number">3241423</span>,<span class="number">3245423</span>,<span class="number">3252523</span>,<span class="number">3256523</span>,<span class="number">3258523</span>,<span class="number">3260623</span>,<span class="number">3267623</span>,<span class="number">3272723</span>,<span class="number">3283823</span>,<span class="number">3285823</span>,<span class="number">3286823</span>,<span class="number">3288823</span>,<span class="number">3291923</span>,<span class="number">3293923</span>,<span class="number">3304033</span>,<span class="number">3305033</span>,<span class="number">3307033</span>,<span class="number">3310133</span>,<span class="number">3315133</span>,<span class="number">3319133</span>,<span class="number">3321233</span>,<span class="number">3329233</span>,<span class="number">3331333</span>,<span class="number">3337333</span>,<span class="number">3343433</span>,<span class="number">3353533</span>,<span class="number">3362633</span>,<span class="number">3364633</span>,<span class="number">3365633</span>,<span class="number">3368633</span>,<span class="number">3380833</span>,<span class="number">3391933</span>,<span class="number">3392933</span>,<span class="number">3400043</span>,<span class="number">3411143</span>,<span class="number">3417143</span>,<span class="number">3424243</span>,<span class="number">3425243</span>,<span class="number">3427243</span>,<span class="number">3439343</span>,<span class="number">3441443</span>,<span class="number">3443443</span>,<span class="number">3444443</span>,<span class="number">3447443</span>,<span class="number">3449443</span>,<span class="number">3452543</span>,<span class="number">3460643</span>,<span class="number">3466643</span>,<span class="number">3470743</span>,<span class="number">3479743</span>,<span class="number">3485843</span>,<span class="number">3487843</span>,<span class="number">3503053</span>,<span class="number">3515153</span>,<span class="number">3517153</span>,<span class="number">3528253</span>,<span class="number">3541453</span>,<span class="number">3553553</span>,<span class="number">3558553</span>,<span class="number">3563653</span>,<span class="number">3569653</span>,<span class="number">3586853</span>,<span class="number">3589853</span>,<span class="number">3590953</span>,<span class="number">3591953</span>,<span class="number">3594953</span>,<span class="number">3601063</span>,<span class="number">3607063</span>,<span class="number">3618163</span>,<span class="number">3621263</span>,<span class="number">3627263</span>,<span class="number">3635363</span>,<span class="number">3643463</span>,<span class="number">3646463</span>,<span class="number">3670763</span>,<span class="number">3673763</span>,<span class="number">3680863</span>,<span class="number">3689863</span>,<span class="number">3698963</span>,<span class="number">3708073</span>,<span class="number">3709073</span>,<span class="number">3716173</span>,<span class="number">3717173</span>,<span class="number">3721273</span>,<span class="number">3722273</span>,<span class="number">3728273</span>,<span class="number">3732373</span>,<span class="number">3743473</span>,<span class="number">3746473</span>,<span class="number">3762673</span>,<span class="number">3763673</span>,<span class="number">3765673</span>,<span class="number">3768673</span>,<span class="number">3769673</span>,<span class="number">3773773</span>,<span class="number">3774773</span>,<span class="number">3781873</span>,<span class="number">3784873</span>,<span class="number">3792973</span>,<span class="number">3793973</span>,<span class="number">3799973</span>,<span class="number">3804083</span>,<span class="number">3806083</span>,<span class="number">3812183</span>,<span class="number">3814183</span>,<span class="number">3826283</span>,<span class="number">3829283</span>,<span class="number">3836383</span>,<span class="number">3842483</span>,<span class="number">3853583</span>,<span class="number">3858583</span>,<span class="number">3863683</span>,<span class="number">3864683</span>,<span class="number">3867683</span>,<span class="number">3869683</span>,<span class="number">3871783</span>,<span class="number">3878783</span>,<span class="number">3893983</span>,<span class="number">3899983</span>,<span class="number">3913193</span>,<span class="number">3916193</span>,<span class="number">3918193</span>,<span class="number">3924293</span>,<span class="number">3927293</span>,<span class="number">3931393</span>,<span class="number">3938393</span>,<span class="number">3942493</span>,<span class="number">3946493</span>,<span class="number">3948493</span>,<span class="number">3964693</span>,<span class="number">3970793</span>,<span class="number">3983893</span>,<span class="number">3991993</span>,<span class="number">3994993</span>,<span class="number">3997993</span>,<span class="number">3998993</span>,<span class="number">7014107</span>,<span class="number">7035307</span>,<span class="number">7036307</span>,<span class="number">7041407</span>,<span class="number">7046407</span>,<span class="number">7057507</span>,<span class="number">7065607</span>,<span class="number">7069607</span>,<span class="number">7073707</span>,<span class="number">7079707</span>,<span class="number">7082807</span>,<span class="number">7084807</span>,<span class="number">7087807</span>,<span class="number">7093907</span>,<span class="number">7096907</span>,<span class="number">7100017</span>,<span class="number">7114117</span>,<span class="number">7115117</span>,<span class="number">7118117</span>,<span class="number">7129217</span>,<span class="number">7134317</span>,<span class="number">7136317</span>,<span class="number">7141417</span>,<span class="number">7145417</span>,<span class="number">7155517</span>,<span class="number">7156517</span>,<span class="number">7158517</span>,<span class="number">7159517</span>,<span class="number">7177717</span>,<span class="number">7190917</span>,<span class="number">7194917</span>,<span class="number">7215127</span>,<span class="number">7226227</span>,<span class="number">7246427</span>,<span class="number">7249427</span>,<span class="number">7250527</span>,<span class="number">7256527</span>,<span class="number">7257527</span>,<span class="number">7261627</span>,<span class="number">7267627</span>,<span class="number">7276727</span>,<span class="number">7278727</span>,<span class="number">7291927</span>,<span class="number">7300037</span>,<span class="number">7302037</span>,<span class="number">7310137</span>,<span class="number">7314137</span>,<span class="number">7324237</span>,<span class="number">7327237</span>,<span class="number">7347437</span>,<span class="number">7352537</span>,<span class="number">7354537</span>,<span class="number">7362637</span>,<span class="number">7365637</span>,<span class="number">7381837</span>,<span class="number">7388837</span>,<span class="number">7392937</span>,<span class="number">7401047</span>,<span class="number">7403047</span>,<span class="number">7409047</span>,<span class="number">7415147</span>,<span class="number">7434347</span>,<span class="number">7436347</span>,<span class="number">7439347</span>,<span class="number">7452547</span>,<span class="number">7461647</span>,<span class="number">7466647</span>,<span class="number">7472747</span>,<span class="number">7475747</span>,<span class="number">7485847</span>,<span class="number">7486847</span>,<span class="number">7489847</span>,<span class="number">7493947</span>,<span class="number">7507057</span>,<span class="number">7508057</span>,<span class="number">7518157</span>,<span class="number">7519157</span>,<span class="number">7521257</span>,<span class="number">7527257</span>,<span class="number">7540457</span>,<span class="number">7562657</span>,<span class="number">7564657</span>,<span class="number">7576757</span>,<span class="number">7586857</span>,<span class="number">7592957</span>,<span class="number">7594957</span>,<span class="number">7600067</span>,<span class="number">7611167</span>,<span class="number">7619167</span>,<span class="number">7622267</span>,<span class="number">7630367</span>,<span class="number">7632367</span>,<span class="number">7644467</span>,<span class="number">7654567</span>,<span class="number">7662667</span>,<span class="number">7665667</span>,<span class="number">7666667</span>,<span class="number">7668667</span>,<span class="number">7669667</span>,<span class="number">7674767</span>,<span class="number">7681867</span>,<span class="number">7690967</span>,<span class="number">7693967</span>,<span class="number">7696967</span>,<span class="number">7715177</span>,<span class="number">7718177</span>,<span class="number">7722277</span>,<span class="number">7729277</span>,<span class="number">7733377</span>,<span class="number">7742477</span>,<span class="number">7747477</span>,<span class="number">7750577</span>,<span class="number">7758577</span>,<span class="number">7764677</span>,<span class="number">7772777</span>,<span class="number">7774777</span>,<span class="number">7778777</span>,<span class="number">7782877</span>,<span class="number">7783877</span>,<span class="number">7791977</span>,<span class="number">7794977</span>,<span class="number">7807087</span>,<span class="number">7819187</span>,<span class="number">7820287</span>,<span class="number">7821287</span>,<span class="number">7831387</span>,<span class="number">7832387</span>,<span class="number">7838387</span>,<span class="number">7843487</span>,<span class="number">7850587</span>,<span class="number">7856587</span>,<span class="number">7865687</span>,<span class="number">7867687</span>,<span class="number">7868687</span>,<span class="number">7873787</span>,<span class="number">7884887</span>,<span class="number">7891987</span>,<span class="number">7897987</span>,<span class="number">7913197</span>,<span class="number">7916197</span>,<span class="number">7930397</span>,<span class="number">7933397</span>,<span class="number">7935397</span>,<span class="number">7938397</span>,<span class="number">7941497</span>,<span class="number">7943497</span>,<span class="number">7949497</span>,<span class="number">7957597</span>,<span class="number">7958597</span>,<span class="number">7960697</span>,<span class="number">7977797</span>,<span class="number">7984897</span>,<span class="number">7985897</span>,<span class="number">7987897</span>,<span class="number">7996997</span>,<span class="number">9002009</span>,<span class="number">9015109</span>,<span class="number">9024209</span>,<span class="number">9037309</span>,<span class="number">9042409</span>,<span class="number">9043409</span>,<span class="number">9045409</span>,<span class="number">9046409</span>,<span class="number">9049409</span>,<span class="number">9067609</span>,<span class="number">9073709</span>,<span class="number">9076709</span>,<span class="number">9078709</span>,<span class="number">9091909</span>,<span class="number">9095909</span>,<span class="number">9103019</span>,<span class="number">9109019</span>,<span class="number">9110119</span>,<span class="number">9127219</span>,<span class="number">9128219</span>,<span class="number">9136319</span>,<span class="number">9149419</span>,<span class="number">9169619</span>,<span class="number">9173719</span>,<span class="number">9174719</span>,<span class="number">9179719</span>,<span class="number">9185819</span>,<span class="number">9196919</span>,<span class="number">9199919</span>,<span class="number">9200029</span>,<span class="number">9209029</span>,<span class="number">9212129</span>,<span class="number">9217129</span>,<span class="number">9222229</span>,<span class="number">9223229</span>,<span class="number">9230329</span>,<span class="number">9231329</span>,<span class="number">9255529</span>,<span class="number">9269629</span>,<span class="number">9271729</span>,<span class="number">9277729</span>,<span class="number">9280829</span>,<span class="number">9286829</span>,<span class="number">9289829</span>,<span class="number">9318139</span>,<span class="number">9320239</span>,<span class="number">9324239</span>,<span class="number">9329239</span>,<span class="number">9332339</span>,<span class="number">9338339</span>,<span class="number">9351539</span>,<span class="number">9357539</span>,<span class="number">9375739</span>,<span class="number">9384839</span>,<span class="number">9397939</span>,<span class="number">9400049</span>,<span class="number">9414149</span>,<span class="number">9419149</span>,<span class="number">9433349</span>,<span class="number">9439349</span>,<span class="number">9440449</span>,<span class="number">9446449</span>,<span class="number">9451549</span>,<span class="number">9470749</span>,<span class="number">9477749</span>,<span class="number">9492949</span>,<span class="number">9493949</span>,<span class="number">9495949</span>,<span class="number">9504059</span>,<span class="number">9514159</span>,<span class="number">9526259</span>,<span class="number">9529259</span>,<span class="number">9547459</span>,<span class="number">9556559</span>,<span class="number">9558559</span>,<span class="number">9561659</span>,<span class="number">9577759</span>,<span class="number">9583859</span>,<span class="number">9585859</span>,<span class="number">9586859</span>,<span class="number">9601069</span>,<span class="number">9602069</span>,<span class="number">9604069</span>,<span class="number">9610169</span>,<span class="number">9620269</span>,<span class="number">9624269</span>,<span class="number">9626269</span>,<span class="number">9632369</span>,<span class="number">9634369</span>,<span class="number">9645469</span>,<span class="number">9650569</span>,<span class="number">9657569</span>,<span class="number">9670769</span>,<span class="number">9686869</span>,<span class="number">9700079</span>,<span class="number">9709079</span>,<span class="number">9711179</span>,<span class="number">9714179</span>,<span class="number">9724279</span>,<span class="number">9727279</span>,<span class="number">9732379</span>,<span class="number">9733379</span>,<span class="number">9743479</span>,<span class="number">9749479</span>,<span class="number">9752579</span>,<span class="number">9754579</span>,<span class="number">9758579</span>,<span class="number">9762679</span>,<span class="number">9770779</span>,<span class="number">9776779</span>,<span class="number">9779779</span>,<span class="number">9781879</span>,<span class="number">9782879</span>,<span class="number">9787879</span>,<span class="number">9788879</span>,<span class="number">9795979</span>,<span class="number">9801089</span>,<span class="number">9807089</span>,<span class="number">9809089</span>,<span class="number">9817189</span>,<span class="number">9818189</span>,<span class="number">9820289</span>,<span class="number">9822289</span>,<span class="number">9836389</span>,<span class="number">9837389</span>,<span class="number">9845489</span>,<span class="number">9852589</span>,<span class="number">9871789</span>,<span class="number">9888889</span>,<span class="number">9889889</span>,<span class="number">9896989</span>,<span class="number">9902099</span>,<span class="number">9907099</span>,<span class="number">9908099</span>,<span class="number">9916199</span>,<span class="number">9918199</span>,<span class="number">9919199</span>,<span class="number">9921299</span>,<span class="number">9923299</span>,<span class="number">9926299</span>,<span class="number">9927299</span>,<span class="number">9931399</span>,<span class="number">9932399</span>,<span class="number">9935399</span>,<span class="number">9938399</span>,<span class="number">9957599</span>,<span class="number">9965699</span>,<span class="number">9978799</span>,<span class="number">9980899</span>,<span class="number">9981899</span>,<span class="number">9989899</span>&#125;;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="type">int</span> <span class="title">main</span><span class="params">()</span></span>&#123;</span><br><span class="line">    <span class="type">int</span> a,b;</span><br><span class="line">    <span class="built_in">scanf</span>(<span class="string">&quot;%d%d&quot;</span>,&amp;a,&amp;b);</span><br><span class="line">    <span class="keyword">for</span>(<span class="type">int</span> i=<span class="number">1</span>;i&lt;=<span class="number">781</span>;i++)&#123;<span class="comment">//781是上个程序中求出的回文质数个数</span></span><br><span class="line">    <span class="keyword">if</span>(ans[i]&gt;=a&amp;&amp;ans[i]&lt;=b) <span class="built_in">printf</span>(<span class="string">&quot;%d\n&quot;</span>,ans[i]);</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>OK，打表解题完毕……让人很无语的解法，但能解出来也确实牛逼emm</p>
<p>PS:打表时如果用文件输入输出的话，会比直接输入输出更快一点</p>
<blockquote>
<p>以上内容摘自 <a target="_blank" rel="noopener external nofollow noreferrer" href="https://www.luogu.com.cn/article/xqsl42z3">https://www.luogu.com.cn/article/xqsl42z3</a></p>
</blockquote>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="https://blog.sevin.cn">Sevin</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://blog.sevin.cn/posts/12620/">https://blog.sevin.cn/posts/12620/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="external nofollow noreferrer" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://blog.sevin.cn" target="_blank">Sevin的小窝</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E6%9A%B4%E5%8A%9B/">暴力</a><a class="post-meta__tags" href="/tags/%E6%8A%80%E5%B7%A7/">技巧</a></div><div class="post_share"><div class="social-share" data-image="https://api.sevin.cn/api/img/ecy/%20(132).jpg" data-sites="qq,wechat,weibo,facebook,twitter"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i> 打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="/img/wechat.png" target="_blank"><img class="post-qr-code-img" src="/img/wechat.png" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="/img/alipay.jpg" target="_blank"><img class="post-qr-code-img" src="/img/alipay.jpg" alt="支付宝"/></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></div><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/posts/36872/" title="p1036选数"><img class="cover" src="https://api.sevin.cn/api/img/ecy/%20(150).jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2024-11-08</div><div class="title">p1036选数</div></div></a></div><div><a href="/posts/63389/" title="打题的时候吸取的教训"><img class="cover" src="https://api.sevin.cn/api/img/ecy/%20(121).jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2024-11-08</div><div class="title">打题的时候吸取的教训</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="gitalk-container"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://q.qlogo.cn/g?b=qq&amp;nk=2720269770&amp;s=640" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Sevin</div><div class="author-info__description">喜欢瞎鼓捣的Sevin！</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">42</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">36</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">8</div></a></div><a id="card-info-btn" target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/itsevin"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://home.sevin.cn/" rel="external nofollow noreferrer" target="_blank" title="Home"><i class="fa-solid fa-house"></i></a><a class="social-icon" href="https://github.com/itsevin" rel="external nofollow noreferrer" target="_blank" title="GitHub"><i class="fab fa-github"></i></a><a class="social-icon" href="https://blog.csdn.net/m0_62568363" rel="external nofollow noreferrer" target="_blank" title="CSDN"><i class="fa-solid fa-c"></i></a><a class="social-icon" href="https://space.bilibili.com/1961300960" rel="external nofollow noreferrer" target="_blank" title="Bili"><i class="fa-brands fa-bilibili"></i></a><a class="social-icon" href="mailto:itsevin@qq.com" rel="external nofollow noreferrer" target="_blank" title="Email"><i class="fas fa-envelope"></i></a><a class="social-icon" href="https://blog.sevin.cn/feed.xml" target="_blank" title="RSS"><i class="fas fa-rss"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">欢迎来Sevin的小窝窝取暖QWQ</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content is-expand"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%B8%80%E7%A7%8D%E6%9C%80%E7%AE%80%E5%8D%95%E7%B2%97%E6%9A%B4%E7%9A%84%E6%89%93%E8%A1%A8%E6%BC%94%E7%A4%BA"><span class="toc-number">1.</span> <span class="toc-text">一种最简单粗暴的打表演示</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BE%8B%E9%A2%98%EF%BC%88P1217-USACO1-5-%E5%9B%9E%E6%96%87%E8%B4%A8%E6%95%B0-Prime-Palindromes%EF%BC%89"><span class="toc-number">1.1.</span> <span class="toc-text">例题（P1217 [USACO1.5] 回文质数 Prime Palindromes）</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%A2%98%E7%9B%AE%E6%8F%8F%E8%BF%B0"><span class="toc-number">1.1.1.</span> <span class="toc-text">题目描述</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%9A%B4%E5%8A%9B%E6%89%93%E8%A1%A8%E8%A7%A3%E6%B3%95"><span class="toc-number">1.1.2.</span> <span class="toc-text">暴力打表解法</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%8A%8A%E4%B8%80%E4%BA%BF%E4%BB%A5%E5%86%85%E7%9A%84%E8%B4%A8%E6%95%B0%E6%89%93%E5%87%BA%E6%9D%A5"><span class="toc-number">1.1.2.1.</span> <span class="toc-text">把一亿以内的质数打出来</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%8A%8A%E5%BE%97%E5%88%B0%E7%9A%84%E8%B4%A8%E6%95%B0%E4%B8%AD%E7%9A%84%E5%9B%9E%E6%96%87%E8%B4%A8%E6%95%B0%E6%89%BE%E5%87%BA%E6%9D%A5"><span class="toc-number">1.1.2.2.</span> <span class="toc-text">把得到的质数中的回文质数找出来</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%89%93%E5%87%BA%E6%9C%80%E7%BB%88%E7%A8%8B%E5%BA%8F"><span class="toc-number">1.1.2.3.</span> <span class="toc-text">打出最终程序</span></a></li></ol></li></ol></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/posts/42943/" title="搜索算法讲解"><img src="https://api.sevin.cn/api/img/ecy/%20(81).jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="搜索算法讲解"/></a><div class="content"><a class="title" href="/posts/42943/" title="搜索算法讲解">搜索算法讲解</a><time datetime="2025-07-06T21:31:11.000Z" title="发表于 2025-07-06 21:31:11">2025-07-06</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/54030/" title="哈夫曼编码：数据压缩的优雅艺术"><img src="https://api.sevin.cn/api/img/ecy/%20(149).jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="哈夫曼编码：数据压缩的优雅艺术"/></a><div class="content"><a class="title" href="/posts/54030/" title="哈夫曼编码：数据压缩的优雅艺术">哈夫曼编码：数据压缩的优雅艺术</a><time datetime="2025-05-19T20:32:07.000Z" title="发表于 2025-05-19 20:32:07">2025-05-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/58365/" title="2025程序设计天梯赛补题报告"><img src="https://api.sevin.cn/api/img/ecy/%20(149).jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="2025程序设计天梯赛补题报告"/></a><div class="content"><a class="title" href="/posts/58365/" title="2025程序设计天梯赛补题报告">2025程序设计天梯赛补题报告</a><time datetime="2025-05-16T22:33:40.000Z" title="发表于 2025-05-16 22:33:40">2025-05-16</time></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('/img/footer.jpg')"><div id="footer-wrap"><div class="copyright">&copy;2025  <i id="heartbeat" class="fa fas fa-heartbeat"></i> Sevin</div><div class="footer_custom_text"><!DOCTYPE html><html><head><meta charset="utf-8"><title></title></head><body><div>鲲鹏九万里 直上云海巅</div><p><a style="margin-inline:5px"target="_blank"href="https://beian.miit.gov.cn/#/Integrated/index/" rel="external nofollow noreferrer"><img src="https://img.shields.io/badge/%E9%97%BDICP%E5%A4%87-2022004931%E5%8F%B7--1-e1d492?style=flat&logo="title="ICP备案"></a><a style="margin-inline:5px"target="_blank"href="http://creativecommons.org/licenses/by-nc-sa/4.0/" rel="external nofollow noreferrer"><img src="https://img.shields.io/badge/Copyright-BY--NC--SA%204.0-d42328?style=flat&logo=Claris"title="本站采用知识共享署名-非商业性使用-相同方式共享4.0国际许可协议进行许可"></a></p><!-- hexo injector body_end start --> <script data-pjax>if(document.getElementById('recent-posts') && location.pathname =='/'){
    
    var parent = document.getElementById('recent-posts');
    var child = '<div class="recent-post-item" style="height: auto;width: 100%"><div class="blog-slider swiper-container-fade swiper-container-horizontal" id="swiper_container"><div class="blog-slider__wrp swiper-wrapper" style="transition-duration: 0ms"><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms"><div class="blog-slider__img"><img src="https://img.sevin.cn/i/2023/10/07/6521756081d56.jpg" alt="https://img.sevin.cn/i/2023/10/07/6521756081d56.jpg"/></div><div class="blog-slider__content"><span class="blog-slider__code">2023-10-07</span><a class="blog-slider__title" href="posts/35833/">Sevin的自我介绍</a><div class="blog-slider__text">关于Sevin的……</div><a class="blog-slider__button" href="posts/35833/">详情</a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms"><div class="blog-slider__img"><img src="https://api.sevin.cn/api/img/ecy/%20(128).jpg" alt="https://api.sevin.cn/api/img/ecy/%20(128).jpg"/></div><div class="blog-slider__content"><span class="blog-slider__code">2022-08-14</span><a class="blog-slider__title" href="posts/24760/">超简单随机文本API制作教程</a><div class="blog-slider__text">随机文本API制作教程，超简单，包会！</div><a class="blog-slider__button" href="posts/24760/">详情</a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms"><div class="blog-slider__img"><img src="https://api.sevin.cn/api/img/ecy/%20(121).jpg" alt="https://api.sevin.cn/api/img/ecy/%20(121).jpg"/></div><div class="blog-slider__content"><span class="blog-slider__code">2022-08-14</span><a class="blog-slider__title" href="posts/20775/">超简单随机图片API制作教程</a><div class="blog-slider__text">随机图片API制作教程，超简单，包会！</div><a class="blog-slider__button" href="posts/20775/">详情</a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms"><div class="blog-slider__img"><img src="https://api.sevin.cn/api/img/ecy/%20(147).jpg" alt="https://api.sevin.cn/api/img/ecy/%20(147).jpg"/></div><div class="blog-slider__content"><span class="blog-slider__code">2022-08-13</span><a class="blog-slider__title" href="posts/39795/">nonebot2调用图片API发送随机图片</a><div class="blog-slider__text">nonebot2调用图片API发送随机图片插件编写指南</div><a class="blog-slider__button" href="posts/39795/">详情</a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms"><div class="blog-slider__img"><img src="https://api.sevin.cn/api/img/ecy/%20(125).jpg" alt="https://api.sevin.cn/api/img/ecy/%20(125).jpg"/></div><div class="blog-slider__content"><span class="blog-slider__code">2022-08-26</span><a class="blog-slider__title" href="posts/8797/">nonebot2调用json格式图片API发送随机图片</a><div class="blog-slider__text">nonebot2调用json格式图片API发送随机图片教程以及插件模板，满满干货！</div><a class="blog-slider__button" href="posts/8797/">详情</a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms"><div class="blog-slider__img"><img src="http://img.sevin.cn/i/2023/06/07/647fef3307e50.jpg" alt="http://img.sevin.cn/i/2023/06/07/647fef3307e50.jpg"/></div><div class="blog-slider__content"><span class="blog-slider__code">2022-03-30</span><a class="blog-slider__title" href="posts/39793/">使用手机软件Bluino Loader通过蓝牙编程、烧录Arduino</a><div class="blog-slider__text">一些小伙伴或许因为没有电脑又想学习Arduino而犯愁，但是在这片文章中我将会带领大家来完美解决这个问题，我们将使用手机软件Bluino Loader通过蓝牙编程、烧录Arduino</div><a class="blog-slider__button" href="posts/39793/">详情</a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms"><div class="blog-slider__img"><img src="https://api.sevin.cn/api/img/ecy/%20(132).jpg" alt="https://api.sevin.cn/api/img/ecy/%20(132).jpg"/></div><div class="blog-slider__content"><span class="blog-slider__code">2022-08-13</span><a class="blog-slider__title" href="posts/39700/">nonebot2调用文本API发送随机图片</a><div class="blog-slider__text">nonebot2调用文本API发送随机文本插件编写指南</div><a class="blog-slider__button" href="posts/39700/">详情</a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms"><div class="blog-slider__img"><img src="https://api.sevin.cn/api/img/ecy/%20(132).jpg" alt="https://api.sevin.cn/api/img/ecy/%20(132).jpg"/></div><div class="blog-slider__content"><span class="blog-slider__code">2022-08-26</span><a class="blog-slider__title" href="posts/26627/">nonebot2调用json格式文本API发送随机文本</a><div class="blog-slider__text">nonebot2调用json格式文本API发送随机文本教程以及插件模板，满满干货！</div><a class="blog-slider__button" href="posts/26627/">详情</a></div></div></div><div class="blog-slider__pagination swiper-pagination-clickable swiper-pagination-bullets"></div></div></div>';
    console.log('已挂载swiper')
    parent.insertAdjacentHTML("afterbegin",child)}
     </script>
<script data-pjax src="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-swiper/swiper/swiper.min.js"></script>
<script data-pjax src="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-swiper@0.18/swiper/swiperindex.js"></script>
<style></style><!-- hexo injector body_end end --></body></html></div></div><head><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/HCLonely/images@master/others/heartbeat.min.css"></head></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.min.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script src="/js/search/local-search.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"><script>if (!window.MathJax) {
  window.MathJax = {
    tex: {
      inlineMath: [ ['$','$'], ["\\(","\\)"]],
      tags: 'ams'
    },
    chtml: {
      scale: 1.2
    },
    options: {
      renderActions: {
        findScript: [10, doc => {
          for (const node of document.querySelectorAll('script[type^="math/tex"]')) {
            const display = !!node.type.match(/; *mode=display/)
            const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display)
            const text = document.createTextNode('')
            node.parentNode.replaceChild(text, node)
            math.start = {node: text, delim: '', n: 0}
            math.end = {node: text, delim: '', n: 0}
            doc.math.push(math)
          }
        }, ''],
        insertScript: [200, () => {
          document.querySelectorAll('mjx-container:not\([display]\)').forEach(node => {
            const target = node.parentNode
            if (target.nodeName.toLowerCase() === 'li') {
              target.parentNode.classList.add('has-jax')
            } else {
              target.classList.add('has-jax')
            }
          });
        }, '', false]
      }
    }
  }
  
  const script = document.createElement('script')
  script.src = 'https://cdn.jsdelivr.net/npm/mathjax/es5/tex-mml-chtml.min.js'
  script.id = 'MathJax-script'
  script.async = true
  document.head.appendChild(script)
} else {
  MathJax.startup.document.state(0)
  MathJax.texReset()
  MathJax.typeset()
}</script><script>function addGitalkSource () {
  const ele = document.createElement('link')
  ele.rel = 'stylesheet'
  ele.href= 'https://cdn.jsdelivr.net/npm/gitalk/dist/gitalk.min.css'
  document.getElementsByTagName('head')[0].appendChild(ele)
}

function loadGitalk () {
  function initGitalk () {
    var gitalk = new Gitalk(Object.assign({
      clientID: '8d3733d4a7331717c73b',
      clientSecret: 'e202858cc2b0404eea2852a3fa77fad762a5cd28',
      repo: 'comment_blog',
      owner: 'itsevin',
      admin: ['itsevin'],
      id: 'd5f50a657da8eb0078833ca3f6809a63',
      updateCountCallback: commentCount
    },null))

    gitalk.render('gitalk-container')
  }

  if (typeof Gitalk === 'function') initGitalk()
  else {
    addGitalkSource()
    getScript('https://cdn.jsdelivr.net/npm/gitalk/dist/gitalk.min.js').then(initGitalk)
  }
}

function commentCount(n){
  let isCommentCount = document.querySelector('#post-meta .gitalk-comment-count')
  if (isCommentCount) {
    isCommentCount.innerHTML= n
  }
}

if ('Gitalk' === 'Gitalk' || !false) {
  if (false) btf.loadComment(document.getElementById('gitalk-container'), loadGitalk)
  else loadGitalk()
} else {
  function loadOtherComment () {
    loadGitalk()
  }
}</script></div><div class="aplayer no-destroy" data-id="60198" data-server="netease" data-type="playlist" data-fixed="true" data-autoplay="false"> </div><script id="canvas_nest" defer="defer" color="0,0,255" opacity="0.7" zIndex="-1" count="99" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-nest.min.js"></script><script id="click-show-text" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/click-show-text.min.js" data-mobile="false" data-text="富强,民主,文明,和谐,自由,平等,公正,法制,爱国,敬业,诚信,友善,歇会" data-fontsize="15px" data-random="false" async="async"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/metingjs/dist/Meting.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>